// 分类模型
const { Cart } = require('../../../models/cart');
// 统一数据返回类
const { DataReturn } = require('../../../common/returnclass');

module.exports = async (req, res) => {
	// 商品id
	let { goods_id } = req.fields;
	console.log(req.fields);
	
	let carts = new Cart(req.fields);
	// 保存商品信息
	carts.save()
	.then(()=>{
		DataReturn.getData(res,200,[],'添加购物车成功')
	}).catch(()=>{
		DataReturn.getData(res,400,[],'添加购物车失败')
	})
	
}